home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / jabber1a / jabberwi.bas < prev    next >
BASIC Source File  |  1999-10-04  |  2KB  |  69 lines

  1. Attribute VB_Name = "Jabber"
  2. ' Define new type
  3. Type MyOptions
  4.     First As String * 1
  5.     MaxWordLen As String * 3
  6.     MinWordLen As String * 3
  7.     WordFile As String * 100
  8.     WordFinal As String * 10
  9.     WordInit As String * 10
  10. End Type
  11.  
  12. Global Opt As MyOptions
  13. Dim Con(100), Vow(100)        ' Container for Consonants & Vowels
  14.  
  15. Public Function OpenLetters()
  16.  
  17. If Len(FrmJabber.TxtFileName.Text) = 0 Then Exit Function
  18.  
  19. ' Open letters file
  20. Open FrmJabber.TxtFileName.Text For Input As #1
  21.  
  22. ' Set form caption
  23. FrmJabber.Caption = App.Title + " " + "1.0" + ": " + StrConv(Left(ExtractFileName(FrmJabber.TxtFileName.Text), Len(ExtractFileName(FrmJabber.TxtFileName.Text)) - 4), vbProperCase)
  24.  
  25. Dim CNumber As Integer, VNumber As Integer, None As String
  26.  
  27. ' Get contents of file
  28. Line Input #1, None
  29.  
  30. ' Check to see it's a valid letters file
  31. If None <> "NUMBER OF CONSONANTS:" Then
  32.     MsgBox "Not a valid letters file", vbOKOnly, "Invalid file"
  33.     GoTo Cl
  34. End If
  35.  
  36. Line Input #1, None
  37. CNumber = None
  38. Line Input #1, None
  39.  
  40. For i = 1 To CNumber
  41.     Line Input #1, Con(i)
  42.     FrmJabber.LstCon.AddItem Con(i)
  43. Next
  44.  
  45. Line Input #1, None
  46. Line Input #1, None
  47. VNumber = None
  48. Line Input #1, None
  49.  
  50. For i = 1 To VNumber
  51.     Line Input #1, Vow(i)
  52.     FrmJabber.LstVow.AddItem Vow(i)
  53. Next
  54.  
  55. Cl:
  56. Close
  57.  
  58. End Function
  59.  
  60. Public Function GRI(LowerBound, UpperBound) As Long
  61.  
  62. ' Get Random seed based on current time & Date
  63. Randomize Int(CDbl((Now))) + Timer
  64.  
  65. ' Get Random number with the random seed
  66. GRI = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
  67.  
  68. End Function
  69.